package com.uvnos4j.matilda.security.controller;

import com.uvnos4j.matilda.commons.utils.UserUtil;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * SecurityController
 * <p>
 * Description:SecurityController
 * </p>
 *
 * @author Guo.wl
 * @version v1.0.0
 * @see com.uvnos4j.matilda.security.controller
 * @since 2020-08-31 22:45:18
 */
@Controller
@RequestMapping("/security")
public class SecurityController {

    @ResponseBody
    @GetMapping("/authentication")
    public Authentication getAuthentication(HttpServletRequest request, HttpServletResponse response) throws Exception {
        return UserUtil.getAuthentication();
    }
}
